#include #ifdef __AVR__ #include #endif #define PIN 8 #define NUMPIXELS 1 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 500 const int analogInPin = A0; const int analogInPin1 = A1; const int analogInPin2 = A2; const int analogInPin3 = A3; int sensorValue25 = 0; int sensorValue50 = 0; int sensorValue75 = 0; int sensorValue100 = 0; void setup() { #if defined(__AVR_ATtiny44__) && (F_CPU == 8000000) clock_prescale_set(clock_div_1); #endif pixels.begin(); pixels.clear(); } void loop() { sensorValue25 = analogRead(analogInPin); sensorValue50 = analogRead(analogInPin1); sensorValue75 = analogRead(analogInPin2); sensorValue100 = analogRead(analogInPin3); //100% full if ( sensorValue100 > 500) { pixels.setPixelColor(0, pixels.Color(0, 0, 255)); pixels.show(); } //75% left else if (( sensorValue100 < 500) && ( sensorValue75 > 500)) { pixels.setPixelColor(0, pixels.Color(0, 255, 0)); pixels.show(); delay(500); } //50% left else if (( sensorValue100 < 500) && ( sensorValue75 < 500) && ( sensorValue50 > 500)) { pixels.setPixelColor(0, pixels.Color(255,255,0)); pixels.show(); delay(500); } //25% left else if (( sensorValue100 < 500) && ( sensorValue75 < 500) && ( sensorValue50 < 500) && ( sensorValue25 > 500)) { pixels.setPixelColor(0, pixels.Color(255,80,0)); pixels.show(); delay(500); } //NO water left else { pixels.setPixelColor(0, pixels.Color(255, 0, 0)); pixels.show(); delay(500); pixels.setPixelColor(0, pixels.Color(0, 0, 0)); pixels.show(); delay(500); } }